package com.idu.entities;

// Generated Sep 5, 2014 3:35:31 PM by Hibernate Tools 3.4.0.CR1

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;

import static javax.persistence.GenerationType.IDENTITY;

import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;

/**
 * User generated by hbm2java
 */
@Entity
@Table(name = "user", catalog = "db_iduwebsite", uniqueConstraints = {
		@UniqueConstraint(columnNames = "userName"),
		@UniqueConstraint(columnNames = "email") })
public class User  {

	private Integer userId;
	private Role role;
	private String userName;
	private String pwd;
	private String fullName;
	private Date birthOfDay;
	private boolean gender;
	private String idCard;
	private String address;
	private String email;
	private String phoneNumber;
	private String avatarPath;
	private String idActive;
	private boolean active;
	private int idx;
	private Set<News> newses = new HashSet<News>(0);

	public User() {
	}

	public User(Role role, String userName, String pwd, String fullName,
			Date birthOfDay, boolean gender, String address, String email,
			boolean active, int idx) {
		this.role = role;
		this.userName = userName;
		this.pwd = pwd;
		this.fullName = fullName;
		this.birthOfDay = birthOfDay;
		this.gender = gender;
		this.address = address;
		this.email = email;
		this.active = active;
		this.idx = idx;
	}

	public User(Role role, String userName, String pwd, String fullName,
			Date birthOfDay, boolean gender, String idCard, String address,
			String email, String phoneNumber, String avatarPath,
			String idActive, boolean active, int idx, Set<News> newses) {
		this.role = role;
		this.userName = userName;
		this.pwd = pwd;
		this.fullName = fullName;
		this.birthOfDay = birthOfDay;
		this.gender = gender;
		this.idCard = idCard;
		this.address = address;
		this.email = email;
		this.phoneNumber = phoneNumber;
		this.avatarPath = avatarPath;
		this.idActive = idActive;
		this.active = active;
		this.idx = idx;
		this.newses = newses;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "userId", unique = true, nullable = false)
	public Integer getUserId() {
		return this.userId;
	}

	public void setUserId(Integer userId) {
		this.userId = userId;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "roleId", nullable = false)
	public Role getRole() {
		return this.role;
	}

	public void setRole(Role role) {
		this.role = role;
	}

	@Column(name = "userName", unique = true, nullable = false, length = 45)
	public String getUserName() {
		return this.userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	@Column(name = "pwd", nullable = false, length = 45)
	public String getPwd() {
		return this.pwd;
	}

	public void setPwd(String pwd) {
		this.pwd = pwd;
	}

	@Column(name = "fullName", nullable = false, length = 45)
	public String getFullName() {
		return this.fullName;
	}

	public void setFullName(String fullName) {
		this.fullName = fullName;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "birthOfDay", nullable = false, length = 10)
	public Date getBirthOfDay() {
		return this.birthOfDay;
	}

	public void setBirthOfDay(Date birthOfDay) {
		this.birthOfDay = birthOfDay;
	}

	@Column(name = "gender", nullable = false)
	public boolean isGender() {
		return this.gender;
	}

	public void setGender(boolean gender) {
		this.gender = gender;
	}

	@Column(name = "idCard", length = 15)
	public String getIdCard() {
		return this.idCard;
	}

	public void setIdCard(String idCard) {
		this.idCard = idCard;
	}

	@Column(name = "address", nullable = false, length = 100)
	public String getAddress() {
		return this.address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	@Column(name = "email", unique = true, nullable = false, length = 45)
	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	@Column(name = "phoneNumber", length = 105)
	public String getPhoneNumber() {
		return this.phoneNumber;
	}

	public void setPhoneNumber(String phoneNumber) {
		this.phoneNumber = phoneNumber;
	}

	@Column(name = "avatarPath", length = 105)
	public String getAvatarPath() {
		return this.avatarPath;
	}

	public void setAvatarPath(String avatarPath) {
		this.avatarPath = avatarPath;
	}

	@Column(name = "idActive", length = 45)
	public String getIdActive() {
		return this.idActive;
	}

	public void setIdActive(String idActive) {
		this.idActive = idActive;
	}

	@Column(name = "active", nullable = false)
	public boolean isActive() {
		return this.active;
	}

	public void setActive(boolean active) {
		this.active = active;
	}

	@Column(name = "idx", nullable = false)
	public int getIdx() {
		return this.idx;
	}

	public void setIdx(int idx) {
		this.idx = idx;
	}

	@OneToMany(fetch = FetchType.EAGER, mappedBy = "user")
	public Set<News> getNewses() {
		return this.newses;
	}

	public void setNewses(Set<News> newses) {
		this.newses = newses;
	}

	@Override
	public boolean equals(Object obj) {
		// TODO Auto-generated method stub
		return true;
	}

}
